<template>
  <div id="app">
    <el-container>
      <el-aside width="200px">
        <div class="logo">
          <h3>管理系统</h3>
        </div>
        <el-menu
          :default-active="$route.path"
          class="el-menu-vertical"
          router
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-menu-item index="/">
            <el-icon><House /></el-icon>
            <span>首页</span>
          </el-menu-item>
          <el-menu-item index="/users">
            <el-icon><User /></el-icon>
            <span>用户管理</span>
          </el-menu-item>
          <el-menu-item index="/products">
            <el-icon><Goods /></el-icon>
            <span>商品管理</span>
          </el-menu-item>
          <el-menu-item index="/orders">
            <el-icon><Document /></el-icon>
            <span>订单管理</span>
          </el-menu-item>
          <el-sub-menu index="/database">
            <template #title>
              <el-icon><Grid /></el-icon>
              <span>数据库管理</span>
            </template>
            <el-menu-item index="/datasource-management">
              <span>数据源管理</span>
            </el-menu-item>
            <el-menu-item index="/database-management">
              <span>数据库实例管理</span>
            </el-menu-item>
            <el-menu-item index="/table-management">
              <span>数据表管理</span>
            </el-menu-item>
            <el-menu-item index="/data-domain-management">
              <span>数据域管理</span>
            </el-menu-item>
            <el-menu-item index="/data-dictionary-management">
              <span>数据字典管理</span>
            </el-menu-item>
          </el-sub-menu>
          <el-sub-menu index="/config-center">
            <template #title>
              <el-icon><Setting /></el-icon>
              <span>配置中心</span>
            </template>
            <el-menu-item index="/config-center/application">
              <span>应用管理</span>
            </el-menu-item>
          </el-sub-menu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <div class="header">
            <h1>Vue Element UI CRUD 管理系统</h1>
          </div>
        </el-header>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { House, User, Goods, Document, Setting, Grid } from '@element-plus/icons-vue'

export default {
  name: 'App',
  components: {
    House,
    User,
    Goods,
    Document,
    Setting,
    Grid
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

.logo {
  padding: 20px;
  text-align: center;
  background-color: #434a50;
  border-bottom: 1px solid #3a3f45;
}

.logo h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.el-aside {
  background-color: #545c64;
  height: 100vh;
}

.el-menu-vertical {
  border-right: none;
  height: calc(100vh - 80px);
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
}

.header h1 {
  margin: 0;
  color: #409eff;
  font-size: 24px;
}

.el-header {
  background-color: #fff;
  border-bottom: 1px solid #e4e7ed;
  box-shadow: 0 1px 4px rgba(0,21,41,.08);
}

.el-main {
  padding: 20px;
  background-color: #f5f5f5;
  min-height: calc(100vh - 60px);
}

.el-container {
  height: 100vh;
}

.el-menu-item {
  height: 50px;
  line-height: 50px;
}

.el-menu-item .el-icon {
  margin-right: 8px;
}
</style>